﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Clandestine.Items
{
    public abstract class Item
    {
        public virtual string IndefiniteArticle
        {
            get
            {
                string[] vowels = new string[] { "a", "e", "i", "o", "u" };
                foreach (string vowel in vowels)
                    if (Name.Substring(0, 1).ToLower() == vowel)
                        return "an";
                return "a";
            }
        }

        protected string name = string.Empty;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private string uuid = string.Empty;
        public string UUID
        {
            get { return uuid; }
            set { uuid = value; }
        }

        public Inventory Container = null;

        public virtual bool PreserveState
        {
            get { return false; }
        }

        public Dictionary<string, string> SaveState()
        {
            throw new NotImplementedException();
        }

        public void LoadState(Dictionary<string, string> state)
        {
            throw new NotImplementedException();
        }

        public virtual void Destroy()
        {
            if (Container != null)
                Container.RemoveItem(this.UUID);
        }

        public Item()
        {
            this.uuid = Guid.NewGuid().ToString();
        }
    }
}
